package net.i4q.sqlved.components;

import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class SQLEditor extends JPanel implements KeyListener {
	JTextArea sqlTextArea = new JTextArea();
	
	public SQLEditor() {
		this.setLayout(new BorderLayout());
		
		sqlTextArea.addKeyListener(this); // Hack to display last pixel row of text (like underscore).
		JScrollPane scrollPane = new JScrollPane(sqlTextArea);
		this.add(scrollPane);
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		JFrame frame  = new JFrame("SQLEditor");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(400,100);
		frame.add(new SQLEditor());
		frame.setVisible(true);
	}
	
	public String getText() {
		return sqlTextArea.getText();
	}

	@Override
	public void keyPressed(KeyEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void keyReleased(KeyEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void keyTyped(KeyEvent arg0) {
		sqlTextArea.repaint();
	}

}
